package t1;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Deserialization {
	public List<StudentBean> deserialization() throws IOException {
		FileReader fr = new FileReader("D:\\T1\\student.txt");
		BufferedReader br = new BufferedReader(fr);
		List<StudentBean> studentList = new ArrayList<>();
		while (true) {
			StudentBean student = new StudentBean();
			student.setName(br.readLine());
			student.setMajor(br.readLine());
			if (student.getMajor() == null) {
				break;
			}
			studentList.add(student);
			student = null;
		}
		br.close();
		fr.close();
		return studentList;
	}
}
